package com.yxy.controller.user;

import com.yxy.common.Result;
import com.yxy.constant.RequestMapperConstant;
import com.yxy.pojo.vo.BannerVO;
import com.yxy.service.BannerService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController("userHomeController")
@RequestMapping(RequestMapperConstant.USER_REQUEST_MAPPER + "home")
@Slf4j
public class HomeController {

    @Autowired
    private BannerService bannerService;

    /**
     * 获取首页轮播图
     * @return
     */
    @GetMapping("/getBannerList")
    public Result<List<BannerVO>> getBannerList() {
        log.info("获取首页轮播图");
        List<BannerVO> bannerVOList = bannerService.getBannerList();
        return Result.success("", bannerVOList);
    }
}
